package com.scbo.common;

/**
 * This class is used to convert number of second to second in a minute, to
 * minute in a hour, to hour.
 * 
 * @author LongNH14
 * 
 */
public class ConvertTime {

	/** The maximum number of second in a minute. */
	private static final int MAX_SECOND = 60;

	/** The maximum number of minute in a hour. */
	private static final int MAX_MINUTE = 60;

	/**
	 * Convert a number to second in a minute.
	 * 
	 * @param ss
	 *            number of second
	 * @return the second in a minute
	 */
	public static int toSecond(int ss) {
		return ss % MAX_SECOND;
	}

	/**
	 * Convert a number to minute in a hour.
	 * 
	 * @param ss
	 *            number of second
	 * @return the minute in a hour
	 */
	public static int toMinute(int ss) {
		return (ss / MAX_SECOND);
	}

	/**
	 * Convert a number to hour.
	 * 
	 * @param ss
	 *            number of second
	 * @return the hour
	 */
	public static int toHour(int ss) {
		return ss / (MAX_SECOND * MAX_MINUTE);
	}

	/**
	 * Convert a integer number to string format. Example : 1 -> "01", 11 ->
	 * "11".
	 * 
	 * @param number
	 *            a integer number
	 * @return a number as string format
	 */
	public static String toNumberString(int number) {
		return (number < 10) ? ("0" + number) : ("" + number);
	}
}
